package com.dckeji.shiplock.webapp.service.impl;

import com.dckeji.shiplock.framework.constants.SystemConstants;
import com.dckeji.shiplock.framework.util.DateTimeUtil;
import com.dckeji.shiplock.framework.util.StringUtil;
import com.dckeji.shiplock.webapp.dao.IDeclareDao;
import com.dckeji.shiplock.webapp.pojo.Declare;
import com.dckeji.shiplock.webapp.service.IDeclareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: TianWei
 * Date: 2017/8/9
 * Time: 9:50
 */
@Service
public class DeclareServiceImpl implements IDeclareService {

    @Autowired
    IDeclareDao declareDao;

    @Override
    public int commitDeclare(Declare declare) {
        declare.setCommitTime(DateTimeUtil.getSystemTime());
        return declareDao.commitDeclare(declare);
    }

    @Override
    public List<Declare> query(String shipNo, Integer status) {

        if (StringUtil.isNull(status)) {
            status = SystemConstants.OPT.WAIT_EXAMINE;
        }
        List<Declare> query = declareDao.query(shipNo, status);


        return query;
    }

    @Override
    public List<Declare> queryDeclareList() {


        return declareDao.queryDeclareList();
    }
}
